package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    /**
     * 根据菜品id查询对应的套餐id
     *
     * @param
     * @param ids
     * @return
     */
    List<Long> getSetmealIdsByDishIds(List<Long> ids);


    /**
     * 新增套餐包含的菜品
     *
     * @param setmealDishes
     */
    void AddSetmeal(List<SetmealDish> setmealDishes);

    /**
     * 删除套餐对应的菜品 法一
     *
     * @param SetmealId
     */
    @Delete("delete from setmeal_dish where setmeal_id=#{SetmealId}")
    void deleteDishBySetmealId(Long SetmealId);

    /**
     * 删除套餐对应的菜品 法二
     *
     * @param ids
     */
    void deleteDishsBySetmealId(List<Long> ids);

    /**
     * 查询与套餐关联的菜品
     *
     * @param SetmealId
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id=#{SetmealId}")
    List<SetmealDish> getDishsBySetmealId(Long SetmealId);
}
